home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5325 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: ix.netcom.com!netnews
  2. From: mchamp@ix.netcom.com (Michael Champagne)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Braces and Inline Assembly?
  5. Date: Sat, 03 Feb 1996 19:38:00 GMT
  6. Organization: Netcom
  7. Message-ID: <4f0di9$rhc@reader2.ix.netcom.com>
  8. References: <4eubgp$6ui@ixnews6.ix.netcom.com> <4eudng$59c@ixnews7.ix.netcom.com>
  9. NNTP-Posting-Host: ix-dfw17-26.ix.netcom.com
  10. X-NETCOM-Date: Sat Feb 03 11:37:45 AM PST 1996
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. >mchamp@ix.netcom.com (Michael Champagne) wrote:
  14.  
  15. >>Ok..  I'm new to using inline assembly and I was wondering why this
  16. >>compiles:
  17.  
  18. >>void set_mode(const int mode)
  19. >>{
  20. >>  asm  {
  21. >>    mov AH, 0;
  22. >>    mov AL, byte ptr mode;
  23. >>    int 10h;
  24. >>  }
  25. >>}
  26.  
  27. >>and this doesn't..
  28.  
  29. >>void set_mode(const int mode)
  30. >>{
  31. >>  asm
  32. >>  {
  33. >>    mov AH, 0;
  34. >>    mov AL, byte ptr mode;
  35. >>    int 10h;
  36. >>  }
  37. >>}
  38.  
  39. >>Seems like it's the exact same code..   does the placement of the
  40. >>braces matter when using the 'asm' statement?  In the second one the
  41. >>compiler doesn't recognize the 'mov' and says there needs to be a
  42. >>couple of semicolons stuck in there. 
  43.  
  44. >>Thanks in advance,
  45.  
  46. >>Mike
  47.  
  48.  
  49. >Sounds like you're using an older version of Borland C/C++.  Perhaps
  50. >version 3.1 or prior?  In those versions the opening brace is required
  51. >on the same line as the the asm keyword.  In later versions, the brace
  52. >doesn't have to be anywhere special.
  53.  
  54. >Jason
  55.  
  56. Nope, I'm using Turbo C++ 4.0..   Hrmm..  weird.
  57.  
  58. Well I guess I'll just remember to put it on the same line.  Thanks
  59. for the reply though.  
  60.  
  61. Mike
  62.  
  63.  
  64.  
  65.